#include "../head/list.h"
#include <string>

// #include <iostream>
using namespace std;
int main()
{
    // cout<<"please tell me what you want to do?(insert/print/erase/exit)\n";
    List list = List();
    string cmd;
    while(cmd!="exit"){
        cout<<"please tell me what you want to do?(insert/print/delete/clear/exit)\n";
        cin>>cmd;
        if (cmd=="insert"){
            int num=0;
            cout<<"please tell me how many numbers you want to insert in?(e.g, '5')\n";
            cin>>num;
            int* i_nums=new int[num];
            cout<<"please tell me what numbers you want to insert in?(e.g, '0 1 2 3 4')\n";
            for (int i=0;i<num;i++){
                cin>>i_nums[i];
                list.insert(i_nums[i]);
            }
        }else if (cmd=="clear"){
            cout<<"The list will be cleared...\n";
            list.~List();
            cout<<"list cleared! Bye! \n";
            return 0;
        }else if (cmd=="delete"){
           int num=0;
            cout<<"please tell me how many numbers you want to delete?(e.g, '5')\n";
            cin>>num;
            int* i_nums=new int[num];
            cout<<"please tell me what numbers you want to delete?(e.g, '0 1 2 3 4')\n";
            for (int i=0;i<num;i++){
                cin>>i_nums[i];
                list.erase(i_nums[i]);
                cout<<i_nums[i]<<" deleted!\n";
            }
        }
        else if(cmd=="print"){
            list.walk_through();
        }else if(cmd=="exit"){
            list.~List();
            cout<<"bye~\n";
            return 0;
        }else{
            cout<<"I dont what you said, please try again.\n";
        }
    }
    return 0;
}